<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script>
    // window.addEventListener('load',function(){
    //     const btn =document.querySelector('button')
    //     btn.addEventListener('click',function(){
    //         alert('点击')
    //     })
    // })


    document.addEventListener('DOMContentLoaded',function(){
        const btn = document.querySelector('button')
        btn.addEventListener('click',function(){
            alert('点击')
        })
    })
</script>
<body>
    <button>按钮</button>
    <img src="" alt="">
</body>

<script>
    // const img = document.querySelector('img')
    // img.addEventListener('Load',function(){
    // })
</script>
</html>